import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/monitor/env_monitor_point_entity.dart';

EnvMonitorPointEntity $EnvMonitorPointEntityFromJson(Map<String, dynamic> json) {
  final EnvMonitorPointEntity envMonitorPointEntity = EnvMonitorPointEntity();
  final int? pointId = jsonConvert.convert<int>(json['pointId']);
  if (pointId != null) {
    envMonitorPointEntity.pointId = pointId;
  }
  final String? point = jsonConvert.convert<String>(json['point']);
  if (point != null) {
    envMonitorPointEntity.point = point;
  }
  final String? deviceCode = jsonConvert.convert<String>(json['deviceCode']);
  if (deviceCode != null) {
    envMonitorPointEntity.deviceCode = deviceCode;
  }
  final String? categoryZh = jsonConvert.convert<String>(json['categoryZh']);
  if (categoryZh != null) {
    envMonitorPointEntity.categoryZh = categoryZh;
  }
  final String? categoryEn = jsonConvert.convert<String>(json['categoryEn']);
  if (categoryEn != null) {
    envMonitorPointEntity.categoryEn = categoryEn;
  }
  return envMonitorPointEntity;
}

Map<String, dynamic> $EnvMonitorPointEntityToJson(EnvMonitorPointEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['pointId'] = entity.pointId;
  data['point'] = entity.point;
  data['deviceCode'] = entity.deviceCode;
  data['categoryZh'] = entity.categoryZh;
  data['categoryEn'] = entity.categoryEn;
  return data;
}

extension EnvMonitorPointEntityExtension on EnvMonitorPointEntity {
  EnvMonitorPointEntity copyWith({
    int? pointId,
    String? point,
    String? deviceCode,
    String? categoryZh,
    String? categoryEn,
  }) {
    return EnvMonitorPointEntity()
      ..pointId = pointId ?? this.pointId
      ..point = point ?? this.point
      ..deviceCode = deviceCode ?? this.deviceCode
      ..categoryZh = categoryZh ?? this.categoryZh
      ..categoryEn = categoryEn ?? this.categoryEn;
  }
}